home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
prog
/
cfuncs.zip
/
ADDAPND.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-09
|
2KB
|
101 lines
#include <funcs.h>
#include <conio.h>
/*-----------------------------Add Append---------------------------*/
/* */
/* DESCRIPTION: If file exists ask if the user would like to start a*/
/* new list, add to an existing one, or exit. */
/* */
/* RETURNS : 'O' if file doesn't exist or new list is chosen */
/* 'A' if append is chosen */
/* 'X' if return is chosen */
/* */
/* USES : Frame, select, OnCursor, OffCursor */
/*------------------------------------------------------------------*/
char AddAppend(const char *file)
{
FrameDataType Fr;
char c, retcode;
int done = 0;
char *display[4], ret;
char choices[] = "123";
if(!FileExists(file)) return('O');
display[0] = " 1 Start a New List ";
display[1] = " 2 Add to an Existing List";
display[2] = " 3 Return to Main Menu ";
Fr.clear = 2;
Frame(&Fr);
while (!done)
{
/* NewClear (LIGHTGRAY, MAGENTA); */
Fr.X = 20; Fr.Y = 2;
Fr.F = LIGHTGRAY; Fr.B = BLUE;
Fr.L = 9; Fr.W = 41;
Fr.txt[1] = " What Do You Wish To Do? ";
Fr.BorderType = 1;
Frame(&Fr);
ret = select(24, 6, 3, choices, display, LIGHTGRAY, BLUE, BLACK, LIGHTGREEN, 0, 0);
if (ret==27)
ret = '3';
switch (ret)
{
case '1':
OffCursor();
Fr.X = 21;
Fr.Y = 7;
Fr.F = WHITE;
Fr.B = BROWN;
Fr.L = 5;
Fr.W = 39;
Fr.txt[0] = " This will erase previous data.";
Fr.txt[2] = " ARE YOU SURE? (Y/N)";
Frame(&Fr);
c = ' ';
while (c != 'Y' && c != 'N' )
{
c = getch();
c = toupper(c);
}
if (c == 'Y')
{
retcode = 'O';
done++;
}
OnCursor();
break;
case '2':
retcode = 'A';
done++;
break;
case '3':
retcode = 'X';
done++;
break;
default:
break;
}
}
return (retcode);
}
/*
void main()
{
AddAppend("A:INVITE.DAT");
}
*/